<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="asserts/js/jquery-3.2.1.slim.min.js"></script>
</head>
<body>
  <div id="id1" th:text="${hello}"></div>
  username:<input th:value="${hello}" id="id2"/>
</body>
<script type="text/javascript">
    $(function(){
        $('#id2').click(function () {
            alert("hello world")
        });
    })
</script>
</html>